<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者，助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
// +----------------------------------------------------------------------
/**
 * Class Config
 * Desc  用户协议
 * Create on 2024/11/26 8:39
 * Create by wangyafang
 */

namespace app\api\controller\wddj\protocol;


use app\common\controller\Api;

class DriverSideProtocol extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\api\model\wddj\protocol\DriverSideProtocol();
    }

    /**
     * Desc 协议
     * Create on 2024/11/26 8:41
     * Create by wangyafang
     */
    public function index()
    {
        if (!$this->request->isGet()) {
            $this->error('请求类型错误');
        }
        $type = $this->request->get('type');
        if (empty($type)) {
            $this->error('类型不能为空');
        }
        switch ($type) {
            case 1:
                $field = 'proxy_driving_agreement';
                break;
            case 2:
                $field = 'legal_terms_and_platform_rules';
                break;
            case 3:
                $field = 'user_agreement';
                break;
            case 4:
                $field = 'privacy_policy';
                break;
        }

        $content = $this->model->where('id',1)->value($field);


        $this->success('请求成功', array(
            'content'=>$content
        ));
    }


}



 